package ios.di.logviewer.ui;

import java.awt.*;

import javax.swing.*;
/**
 * 搜索面板，里面存放着用于输入搜索信息的各个控件
 * @author LuoHouQi
 *
 */
public class SearchPanel extends JPanel {
	LayoutManager lay ;
	private MainFrame mainFream ;
	JLabel businessType_Label;
	JLabel vendorID_Label;
	JLabel businessDate_Label;
	JLabel happenDate_Label;
	
	JComboBox bunessType_CB;
	JTextField vendorID_TA;
	JTextField bunessStartDate_TA,bunessEndDate_TA;
	JTextField happenStartDate_TA,happenEndDate_TA;
	JLabel toLabel,toLabel2;
	JButton searchButton;
	public SearchPanel(MainFrame mainFream) {
		super();
		this.mainFream = mainFream;
		this.initialize();
	}
	
	private void initialize()
	{
		
//		lay = new GridLayout(4,4,3,3);
//		this.setLayout(lay);
		
		businessType_Label = new JLabel("业务类型          ");
		bunessType_CB =this.getBusinessType_CB();		
		bunessType_CB.setSize(60, 18);
//		this.add(businessType_Label);
//		this.add(bunessType_CB);
		
		vendorID_Label = new JLabel("供应商ID          ");
		vendorID_Label.setName("供应商ID");
		vendorID_TA = new JTextField(8);


		businessDate_Label = new JLabel("业务数据日期 ");		
		bunessStartDate_TA = new JTextField(20);
		toLabel = new JLabel("至");
		bunessEndDate_TA = new JTextField(20);

		
		 happenDate_Label = new JLabel("上传/下载时间");
		 happenStartDate_TA = new JTextField(20);
		 toLabel2 = new JLabel("至");
		 happenEndDate_TA = new JTextField(20);

		 
		 searchButton = new JButton("搜索");
		 searchButton.setSize(40, 120);
		 searchButton.setActionCommand("Search");
		 searchButton.addActionListener(this.mainFream);

			
		 
		 
		 
		 
		 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
	        this.setLayout(layout);
	        layout.setHorizontalGroup(
	            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(layout.createSequentialGroup()
	                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	                    .addGroup(layout.createSequentialGroup()
	                        .addComponent(this.businessType_Label)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(this.bunessType_CB,javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                    .addGroup(layout.createSequentialGroup()
	                        .addComponent(this.vendorID_Label)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(this.vendorID_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                    .addGroup(layout.createSequentialGroup()
	                        .addComponent(this.businessDate_Label)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(this.bunessStartDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(this.toLabel)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(this.bunessEndDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                    .addGroup(layout.createSequentialGroup()
	                        .addComponent(this.happenDate_Label)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(this.happenStartDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	                            .addComponent(this.searchButton)
	                            .addGroup(layout.createSequentialGroup()
	                                .addComponent(this.toLabel2)
	                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                                .addComponent(this.happenEndDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
	                )
	        );
	        layout.setVerticalGroup(
	            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(layout.createSequentialGroup()
	                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(this.businessType_Label)
	                    .addComponent(this.bunessType_CB))
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(this.vendorID_Label)
	                    .addComponent(this.vendorID_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(this.businessDate_Label)
	                    .addComponent(this.bunessStartDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
	                    .addComponent(this.toLabel)
	                    .addComponent(this.bunessEndDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(this.happenDate_Label)
	                    .addComponent(this.happenStartDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
	                    .addComponent(this.toLabel2)
	                    .addComponent(this.happenEndDate_TA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addComponent(this.searchButton)
	                )
	        );
	}

	public JComboBox getBusinessType_CB() {
		if(this.bunessType_CB ==null)
		{
			String[] bunessTypes = {"全部","仓储订单","仓储日销售"};
			this.bunessType_CB = new JComboBox(bunessTypes);			
		}
		return bunessType_CB;
	}



	public JTextField getVendorID_TA() {
		return vendorID_TA;
	}

	public void setVendorID_TA(JTextField vendorID_TA) {
		this.vendorID_TA = vendorID_TA;
	}

	public JTextField getBusinessStartDate_TA() {
		return bunessStartDate_TA;
	}

	public void setBusinessStartDate_TA(JTextField bunessStartDate_TA) {
		this.bunessStartDate_TA = bunessStartDate_TA;
	}

	public JTextField getBusinessEndDate_TA() {
		return bunessEndDate_TA;
	}

	public void setBusinessEndDate_TA(JTextField bunessEndDate_TA) {
		this.bunessEndDate_TA = bunessEndDate_TA;
	}

	public JTextField getHappenStartDate_TA() {
		return happenStartDate_TA;
	}

	public void setHappenStartDate_TA(JTextField happenStartDate_TA) {
		this.happenStartDate_TA = happenStartDate_TA;
	}

	public JTextField getHappenEndDate_TA() {
		return happenEndDate_TA;
	}

	public void setHappenEndDate_TA(JTextField happenEndDate_TA) {
		this.happenEndDate_TA = happenEndDate_TA;
	}
	
}
